<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
      <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8" http-equiv="content-type" content="text/html">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>帮帮</title>
<style>
a:visited,
a:hover,
a:active {
  text-decoration: none;
}

a:link {
  text-decoration: none;
  color: #000;
}

body {
  font-family: "微软雅黑";
  background-color: #eee;
/*  font-size: 20px;*/
}
</style>

<jsp:include page="../headres.jsp" flush="true" />
<link rel="stylesheet" type="text/css" href="css/help.css">

<script>
$(document).bind('mobileinit',function(){
 $.mobile.changePage.defaults.changeHash = false;
 $.mobile.hashListeningEnabled = false;
 $.mobile.pushStateEnabled = false;
});
</script>
</head>

<body>
<input type="hidden" data-page="1" id="pageName"/>
<div data-role="page" id="user_page">
  <div data-role="content" class="content" id="content">
    <div class="bg">
       <img class="photo" src="images/help_bg.png" />
    </div>
    <div class="help_nav">
      <ul>
        <li><a href="javascript:void(0)" class="AhelpCategory" category="0">取东西</a></li>
        <li id="buy"><a href="javascript:void(0)" class="AhelpCategory" category="1">买东西</a></li>
        <li><a href="javascript:void(0)" class="AhelpCategory" category="2">送东西</a></li>
      </ul>
    </div>

    
  </div>
        
   <jsp:include page="../footer.jsp" flush="true" />       
</div>
</body>
<script type="text/javascript">
$(function(){
	setBase();
	//分类点击事件
	$(".AhelpCategory").click(function(){
		var category = $(this).attr("category");
		$(".h_list").remove();
		loadHelpList(category,1);
	});
})
function setBase(){
	loadHelpList(1,1);
}
function loadStoryDetail(div){
	var id = $(div).attr("id");
	window.location.href="api/help/helpDetail.do?HELP_ID="+id;
}
//item点击跳转
/* $(".h_list").click(function(){
	var id = $(this).attr("id");
	window.location.href="api/help/helpDetail.do?HELP_ID="+id;
}); */
//加载帮帮列表
var isLast = false;
function loadHelpList(helpCategory,pageNum){
	if(isLast == false){
		$.post("api/help/getHelpByHelpCategory.do",{helpCategory:helpCategory,pageNum:pageNum,pageSize:10},
		function(data){
			if(data["STATUS"]=="OK"){
				var resultListJson = eval("("+data["RESULTLIST"]+")");
				if(typeof(resultListJson)=='undefined' ){return;}
				var html= '';
				$.each(resultListJson,function(keyDaily,valueDaily){
					html +='<div class="h_list" id="'+valueDaily.ID+'" onclick="loadStoryDetail(this);">';
					html +='<div class="h_user">';
					html +='<div class="h_user_pic">';
					html +='<a href="javascript:void(0)">';
					html +='<img src="'+valueDaily.USERIMG+'" />';
					html +='</a>';
					html +='</div>';
					html +='<div class="h_user_name">';
					html +='<span class="name">'+valueDaily.NICKNAME+'</span>';
					html +='<span>'+valueDaily.TIME+'</span>';
					html +='</div>';
					html +='<div class="h_user_grade">';
					html +='<img src="images/g'+valueDaily.LEVEL+'.png" />';
					html +='</div>';
					html +='<div class="h_jiedan">';
					html +='<img src="images/jiedan.png" />';
					html +='<div><a href="javascript:void(0)">接单</a></div>';
					html +='</div>';
					html +='</div>';
					html +='<div class="h_text">';
					html +='<p class="text-u">'+valueDaily.TITLE+'</p>';
					html +='<p class="text_col">'+valueDaily.TASK+'</p>';
					html +='</div>';
					if(valueDaily.IMGS !=""){
					var img = valueDaily.IMGS.spilt(',');
						html +='<div class="foods_pic">';
						html +='<ul>';
						for(var ii=0;ii<img.length;ii++){
							html +='<li>';
							html +='<a href="javascript:void(0)">';
							html +='<img src="'+img[ii]+'" />';
							html +='</a>';
							html +='</li>';
						}
						html +='</ul>';
						html +='</div>';
					}
					
					html +='<div class="address" id="address">';
					html +='<img src="images/place1.png" />';
					html +='<span>'+valueDaily.LOCATION+'</span>';
					html +='<a href="javascript:void(0)">';
					html +='<img src="images/assess.png" />';
					html +='<span>'+valueDaily.COMMENTNUM+'</span>';
					html +='</a>';
					html +='</div>';
					html +='</div> ';
					
				});
				isLast = data["isLast"];
				$("#content").append(html);
			}
		},'json');
	}
}


</script>
</html>